﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using EzDesk.Generic;
using EzDesk.DesktopClient.Event;
using EzDesk.DesktopClient.ViewModel;

namespace BrowserTest
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {

        private TopPanelViewModel _topPanel;

        public TopPanelViewModel TopPanel
        {
            get {
                _topPanel = _topPanel ?? new TopPanelViewModel();
                
                return _topPanel; }
            set { _topPanel = value; }
        }


        public Window1()
        {
            InitializeComponent();
            Init();
        }

        private void Init()
        {
            HeaderContentContainer.Content = this.TopPanel.View;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }

        private void URLTbx_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                FunctionNavigateEvent.Instance.Publish(new FunctionNavigateArgs{ Url=URLTbx.Text});
            }
        }

        private void Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }
    }
}
